package com.qingzhou.web.controller.edc;

import com.mybatisflex.core.paginate.Page;
import com.qingzhou.common.enums.BusinessType;
import com.qingzhou.common.web.controller.BaseController;
import com.qingzhou.framework.annotation.QzLog;
import com.qingzhou.web.repository.entity.CollectEntity;
import com.qingzhou.web.repository.entity.OmicsCollectEntity;
import com.qingzhou.web.service.EdcConstants;
import com.qingzhou.web.service.OmicsCollectService;
import com.qingzhou.web.service.impl.params.request.*;
import com.qingzhou.web.service.impl.params.vo.CollectVo;
import com.qingzhou.web.service.impl.params.vo.OmicsCollectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.noear.solon.annotation.*;
import org.noear.solon.core.handle.Result;

@Api(EdcConstants.EDC_OMICS_COLLECT)
@Controller
@Mapping("edc/omicsCollect")
public class OmicsCollectController extends BaseController {

    @Inject
    OmicsCollectService omicsCollectService;


    @ApiOperation("新增"+EdcConstants.EDC_OMICS_COLLECT)
    @QzLog(title = "新增"+EdcConstants.EDC_OMICS_COLLECT, businessType = BusinessType.INSERT)
    //@AuthPermissions("edc:collect:add")
    @Post
    @Mapping("add")
    public Result<Void> add(OmicsCollectAddForm form) {
        return toResult(omicsCollectService.add(form));
    }

    @ApiOperation("删除"+EdcConstants.EDC_OMICS_COLLECT)
    @QzLog(title = "删除"+EdcConstants.EDC_OMICS_COLLECT, businessType = BusinessType.DELETE)
    //@AuthPermissions("edc:collect:delete")
    @Post
    @Mapping("delete")
    public Result<Void> delete(OmicsCollectDeleteForm form) {
        return toResult(omicsCollectService.delete(form));
    }

    //@AuthPermissions("edc:collect:page")
    @Post
    @Mapping("page")
    @ApiOperation(EdcConstants.EDC_OMICS_COLLECT+"分页")
    public Page<OmicsCollectVo> page(Page<OmicsCollectEntity> page, SubTablePageForm form) {
        return omicsCollectService.page(page,form);
    }

    //@AuthPermissions("edc:collect:detail")
    @Get
    @Mapping("detail")
    @ApiOperation(EdcConstants.EDC_OMICS_COLLECT+"详情")
    public OmicsCollectVo detail(OmicsCollectDetailForm form) {
        return omicsCollectService.detail(form);
    }

    @ApiOperation("编辑"+EdcConstants.EDC_OMICS_COLLECT)
    @QzLog(title = "编辑"+EdcConstants.EDC_OMICS_COLLECT, businessType = BusinessType.INSERT)
    //@AuthPermissions("edc:collect:edit")
    @Post
    @Mapping("edit")
    public Result<Void> edit(OmicsCollectEditForm form) {
        return toResult(omicsCollectService.edit(form));
    }

    @ApiOperation("数据检查"+EdcConstants.EDC_OMICS_COLLECT)
    @QzLog(title = "数据检查"+EdcConstants.EDC_OMICS_COLLECT, businessType = BusinessType.INSERT)
    //@AuthPermissions("edc:collect:forceEdit")
    @Post
    @Mapping("forceEdit")
    public Result<Void> forceEdit(OmicsCollectForceEditForm form) {
        return toResult(omicsCollectService.forceEdit(form));
    }

    @ApiOperation("核实"+EdcConstants.EDC_OMICS_COLLECT)
    @QzLog(title = "核实"+EdcConstants.EDC_OMICS_COLLECT, businessType = BusinessType.INSERT)
    //@AuthPermissions("edc:collect:done")
    @Post
    @Mapping("done")
    public Result<Void> done(OmicsCollectDoneForm form) {
        return toResult(omicsCollectService.done(form));
    }
    @ApiOperation("终止"+EdcConstants.EDC_OMICS_COLLECT)
    @QzLog(title = "终止"+EdcConstants.EDC_OMICS_COLLECT, businessType = BusinessType.INSERT)
    //@AuthPermissions("edc:collect:stop")
    @Post
    @Mapping("stop")
    public Result<Void> stop(OmicsCollectStopForm form) {
        return toResult(omicsCollectService.stop(form));
    }
}
